package Servelet;

import pojo.Student;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/***
 *@title $NAME
 *@description <TODO description class purpose>
 *@author Tang'ya'kang
 *@VERSION 1.0.0
 *@CREATE 2023/5/8 15:57
 **/
public class ServletTest extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Student> list=new ArrayList<>();
        for(int i=0;i<10;++i)
        {
            list.add(new Student(i+1,"name"+i,i+18,"phone"+i));
        }
        request.setAttribute("list",list);
        request.getRequestDispatcher("/test/test2.jsp").forward(request,response);
    }
}
